﻿using System;
using System.Collections.Generic;
using System.Text;
using Tassdar.Framework.Model.Base;

namespace Tassdar.Framework.WebApi
{
    public class AbstractApiController : ControllerBase
    {
        public virtual ResultModel Result(string result)
        {
            var resModel = new ResultModel();
            if (string.IsNullOrEmpty(result))
            {
                resModel.Success = true;
            }
            else
            {
                resModel.Success = false;
                resModel.Message = result;
            }
            return resModel;
        }

        public ResultModel NotLogin()
        {
            return new ResultModel
            {
                Code = "403",
                Message = "未登录!",
                Success = false
            };
        }

        public ResultModel NotAuthed()
        {
            return new ResultModel
            {
                Code = "401",
                Message = "没有访问权限！",
                Success = false
            };
        }
    }
}
